﻿using System.Net.Http.Json;

namespace VirtuslTestServer
{
    internal class Program
    {
        static async Task Main(string[] args)
        {
            Console.WriteLine("请输入设备资源号：");
            var deviceId = Console.ReadLine();

            Console.WriteLine("输入 Q 退出...");
            HttpClient client = new HttpClient();

            while (deviceId != null)
            {
                Console.WriteLine("请输入级片类别：");
                var value = Console.ReadLine();
                if (string.Equals("q", value, StringComparison.OrdinalIgnoreCase))
                {
                    break;
                }

                var result = await client.PostAsJsonAsync("https://172.18.65.139:44385/ClassifyMaterial/ClassifyMAterial", new
                {
                    DeviceId = deviceId,
                    Message = value
                });

                if (result.IsSuccessStatusCode)
                {
                    Console.WriteLine("推送级片信息成功！");
                }
                else
                {
                    Console.WriteLine($"推送级片信息失败，HTTPCODE={result.StatusCode}");
                }
            }

            Console.WriteLine("Quit ...");
        }
    }
}
